import { useStore } from 'vuex'

export function useChat() {
  const store = useStore()

  const addChat = (uuid, chat) => {
    console.log('==userChat-addChat', uuid, chat)
    store.dispatch('chat/addChatByUuid', { uuid, chat })
  }

  const updateChat = (uuid, index, chat) => {
    console.log('==userChat-updateChat', uuid, index, chat)
    store.dispatch('chat/updateChatByUuid', { uuid, index, chat })
  }

  return {
    addChat,
    updateChat
  }
}